<!DOCTYPE html>
<html>


	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>


	<body>
		<form action="" method="post">
			<select name="" id="sheng">
				<option value="">所在省市</option>
			</select>
			<select name="" id="shi">
				<option value="">所在市区</option>
			</select>
			<select name="" id="qu">
				<option value="">所在区</option>
			</select>
		</form>


		<script type="text/javascript">
			var shengarr = ["北京", "天津", "内蒙古自治区", "上海", "广东省"];
			shengarr["北京"] = [
				["市辖区"],
				[
				["朝阳区", "宣武区", "朝阳区", "东城区", "西城区", "房山区"]
				]
			]
			shengarr["天津"] = [
				["市辖区"],
				[
				["西青区", "河东区", "东丽区", "南开区", "红桥区", "和平区"]
				]
			]
			shengarr["内蒙古自治区"] = [
				["赤峰市", "呼伦贝尔市", "呼和浩特市"],
				[
					["元宝山区", "新城区", "松山区", "南山"],
					["扎兰屯", "可可西里", "乌兰察布", ],
					["新城区", "回民区", "新会区"],
					
				]
			]
			shengarr["上海"] = [
				["市辖区"],
				[
				["徐汇区", "黄浦区", "静安区", "宝山区", "嘉定区", "长宁区"]
				]
			]
			shengarr["广东省"] = [
				["广州市", "深圳市", "汕头市", "珠海市"],
				[
					["天河区", "海珠区", "白云区", "花都区", "南沙区"],
					["罗湖区", "福田区", "南山区", "龙华区"],
					["龙湖区", "金平区", "潮南区", "潮阳区", "南澳区"],
					["香洲区", "斗门区", "金湾区"]
				]
			];


			function fun1() {
				var ssheng = document.getElementById("sheng");
				var ssh = document.getElementById("shi")
				var squ = document.getElementById("qu")
				for(var i = 0; i < shengarr.length; i++) {
					ssheng.appendChild(new Option(shengarr[i]));
				}
				ssheng.onchange = function() {


					if(this.value) {
						var shi = shengarr[this.value][0];
						ssh.options.length=1;
						for(var k = 0; k < shi.length; k++) {
							ssh.appendChild(new Option(shi[k]))
						}
					}
				}
				ssh.onchange = function() {
					if(this.value) {
						var qqu = shengarr[ssheng.value][1][this.selectedIndex-1];
						console.log(ssheng.value)
						squ.options.length=1;
						for(var z = 0; z < qqu.length; z++) {
							squ.appendChild(new Option(qqu[z]));
						}
					}
				}
			}
			fun1();


			
		</script>
	</body>


</html>